package main

import (
	"fmt"
)

var less []int
var greater []int
var key []int

func main() {
	list := []int{1,2,3,4,5,7,8,2}
	s := fastSort(list)
	fmt.Println(s)
}

func fastSort(list []int) []int {
	if len(list) < 2 {
		return list
	}else {
		back := list[0]
		for i,item := range list{
			if item < back{
				less = append(less,item)
			}
			if item > back {
				greater =append(greater,item)
			}
		}
		key = append(fastSort(less),back)
		return append(key,fastSort(greater)...)
	}
}



